<template>
	<view class="systemSet">
		<view class="other">
			<view class="menus">
				<view class="line dFlex jBetween_aCenter" @tap='goPage(1)'>
					<view class='lineContent dFlex jStart_aCenter'>
						<view class="menuIcon imgPublic">
							<image src="https://zl-tuangou.oss-cn-qingdao.aliyuncs.com/cMini/setIcon1.png" mode="widthFix"></image>
						</view>
						<text>账号信息</text>
					</view>
					<view class="rightIcon imgPublic">
						<image src="https://zl-tuangou.oss-cn-qingdao.aliyuncs.com/cMini/right.png" mode="widthFix"></image>
					</view>
				</view>
				<view class="line dFlex jBetween_aCenter" @tap='goPage(3)' v-if='datas.user_level == 2'>
					<view class='lineContent dFlex jStart_aCenter'>
						<view class="menuIcon imgPublic">
							<image src="https://zl-tuangou.oss-cn-qingdao.aliyuncs.com/cMini/setIcon2.png" mode="widthFix"></image>
						</view>
						<text>自提地址</text>
					</view>
					<view class="rightIcon imgPublic">
						<image src="https://zl-tuangou.oss-cn-qingdao.aliyuncs.com/cMini/right.png" mode="widthFix"></image>
					</view>
				</view>
				<!-- <view class="line dFlex jBetween_aCenter" @tap='goPage(4)' v-if='datas.user_level == 2'>
					<view class='lineContent dFlex jStart_aCenter'>
						<view class="menuIcon imgPublic">
							<image src="https://zl-tuangou.oss-cn-qingdao.aliyuncs.com/cMini/setIcon3.png" mode="widthFix"></image>
						</view>
						<text>冷藏冷冻品申请</text>
					</view>
					<view class="rightIcon imgPublic">
						<image src="https://zl-tuangou.oss-cn-qingdao.aliyuncs.com/cMini/right.png" mode="widthFix"></image>
					</view>
				</view> -->
				<view class="line dFlex jBetween_aCenter" @tap='goPage(5)'>
					<view class='lineContent dFlex jStart_aCenter'>
						<view class="menuIcon imgPublic">
							<image src="https://zl-tuangou.oss-cn-qingdao.aliyuncs.com/cMini/setIcon4.png" mode="widthFix"></image>
						</view>
						<text>意见反馈</text>
					</view>
					<view class="rightIcon imgPublic">
						<image src="https://zl-tuangou.oss-cn-qingdao.aliyuncs.com/cMini/right.png" mode="widthFix"></image>
					</view>
				</view>
				<view class="line dFlex jBetween_aCenter" @tap='goPage(2)'>
					<view class='lineContent dFlex jStart_aCenter'>
						<view class="menuIcon imgPublic">
							<image src="https://zl-tuangou.oss-cn-qingdao.aliyuncs.com/cMini/setIcon5.png" mode="widthFix"></image>
						</view>
						<text>隐私政策</text>
					</view>
					<view class="rightIcon imgPublic">
						<image src="https://zl-tuangou.oss-cn-qingdao.aliyuncs.com/cMini/right.png" mode="widthFix"></image>
					</view>
				</view>
			</view>
		</view>
		<view class="addBtn" @tap='quit()'>退出登录</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				datas:{},
			};
		},
		onShow(){
			this.initUser();
		},
		onShareAppMessage() {
			this.tool.monitor();
			return {
				title:'加一精选',
				path:'/pages/seller',
				imageUrl:'https://zl-tuangou.oss-cn-qingdao.aliyuncs.com/cMini/logo.png',
				desc:'这里有众多优质好物等您来选择',
			} 
		},
		onShareTimeline() {
			this.tool.monitor();
			let share = {
				title:'加一精选',
				path:'/pages/seller',
				imageUrl:'https://zl-tuangou.oss-cn-qingdao.aliyuncs.com/cMini/logo.png',
				desc:'这里有众多优质好物等您来选择',
			}
			return share;
		},
		methods:{
			// 获取用户信息
			initUser(){
				this.tool.getData('/api/user/info',{},'',this).then(res=>{
					if(res){
						this.datas = res;
					}
				}).catch(err=>{
					console.log(err);
				})
			},
			goPage(idx){
				if(idx == 1){
					uni.navigateTo({
						url:'../my/account'
					})
				}else if(idx == 2){
					uni.navigateTo({
						url:'../my/privacy'
					})
				}else if(idx == 5){
					uni.navigateTo({
						url:'../my/feedBack'
					})
				}else if(idx == 3){
					uni.navigateTo({
						url:'../my/tmAddress'
					})
				}else if(idx == 4){
					if(this.datas.address_id){
						uni.navigateTo({
							url:'../my/apply'
						})
					}else{
						uni.showToast({
							title:'请先完善自提地址',
							icon:"none"
						})
					}
				}
			},
			// 退出
			quit(){
				uni.showModal({
					content:"确定退出当前账号？",
					success: (op) => {
						if(op.confirm){
							uni.removeStorageSync('uToken');
							uni.removeStorageSync('tjr_mobile');
							uni.switchTab({
								url:'/pages/seller'
							})
						}
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	page{
		background: #f1f1f1;
	}
	.systemSet{
		width: 100%;
		padding: 24rpx 3%;
		box-sizing: border-box;
		.config{
			padding: 12px;
			box-sizing: border-box;
		}
		.other {
			width: 100%;
			border-radius: 8px;
			box-sizing: border-box;
			background: white;
			padding: 0 15px;
			box-sizing: border-box;
			.menus {
				width: 100%;
				.line {
					width: 100%;
					padding: 12px 0;
					box-sizing: border-box;
					border-bottom: 1px solid #E9E9E9;
					.lineContent {
						flex: 1;
						.menuIcon {
							width: 20px;
							margin-right: 6px;
						}
					}
					.rightIcon {
						width: 16px;
					}
				}
				.line:last-child {
					border: none;
				}
			}
		}
		.addBtn{
			width: 74.4%;
			position: fixed;
			left: 12.8%;
			bottom: 32px;
			text-align: center;
			color: #666666;
			border-radius: 50px;
			padding: 22rpx 0;
			background: white;
			font-size: 16px;
		}
	}
</style>
